package Ms.service.Impl;

import cn.dev33.satoken.secure.BCrypt;
import Ms.dao.UserMapper;
import Ms.entity.User;
import Ms.entity.enums.UserStatus;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import Ms.service.UserService;

@Service
@Slf4j
public class UserServiceImpl implements UserService {
    @Autowired
    UserMapper userMapper;

    @Override
    public User getUserById(Long userId) {
        return null;
    }

    @Override
    public boolean updateUserStatus(Long userId, UserStatus status) {
        int rows = userMapper.updateStatusById(userId, status);
        return rows > 0;
    }

    @Override
    public boolean updatePassword(Long userId, String newPassword) {
        String encryptedPwd = BCrypt.hashpw(newPassword, BCrypt.gensalt());
        return userMapper.updatePassword(userId, encryptedPwd) > 0;
    }

    @Override
    public boolean updateById(User user) {
        return false;
    }

    @Override
    public Integer countUsers(String student) {
        return null;
    }
}
